When the two German states were founded in 1949, both considered themselves the only lawful representative of the entire German nation and thus the successor state to the German Reich. For the West German view, you can find an extensive overview on Wikipedia’s article covering the Hallstein Doctrine. For the GDR view, I present you article 1 of the initial 1949 GDR constitution which reads:
Deutschland ist eine unteilbare demokratische Republik; sie baut sich auf den deutschen Ländern auf.
Die Republik entscheidet alle Angelegenheiten, die für den Bestand und die Entwicklung des deutschen Volkes in seiner Gesamtheit wesentlich sind; alle übrigen Angelegenheiten werden von den Ländern selbständig entschieden.
Die Entscheidungen der Republik werden grundsätzlich von den Ländern ausgeführt.
Es gibt nur eine deutsche Staatsangehörigkeit.
Only the first and fourth paragraphs are important here, they translate to:
Germany is an inseparable democratic republic; it is made up of states (Länder).
[…]
Only one German nationality exists.
Towards the end of the 1950’s, the GDR shifted away from this idea of an exclusive mandate as they no longer considered a reunification possible. Instead, they strived for international recognition and criticised the Alleinvertretungsanmaßung (presumptiousness of exclusive mandate) of the Hallstein Doctrine that the FRG continued to uphold.
Following the transition of power from CDU to SPD in the FRG in 1969 with the new chancellor Willy Brandt, the FRG started to adopt a slightly new foreign policy which acknowledged the existence of a second German state (but continued to strive for reunification in principle and avoided terms typically associated with independent states; for example, instead of an ‘embassy’ they kept a ‘permanent representation’). Thereafter, the GDR relinquished its claims on West Germany bit by bit, removing all such evidence from its constitution in 1974. However, they still claimed partial successorship by claiming part of the territory and nation of the former Reich.
As for the two countries’ view of the events post 1945: the FRG always considered it a successor state of and thus identical according to international law with the Reich. A number of laws from prior to 1945 were retained – some even predating the First World War and dating back to the German Empire of 1871. While the GDR initially also held a similar view it shifted along with giving up its claims of representing the entirety of Germany to the view that the Reich had ceased to exist in 1945 and new states were founded on vacant territory.
This meant that the FRG would claim in the presence of other nations (e.g. at the UN) to be the successor state of the German Reich while the GDR did not pursue such a claim and rather considered itself newly founded. The FRG would honour international treaties predating its founding in 1945 (like for example the Concordate with the Holy See; the first one I thought of off the top of my head). The GDR would typically not consider itself bound by these.
The international community will typically consider you accordingly depending on how you act. If you claim to be a successor and honour your claimed predecessor’s responsibilities, other countries will accept you as such a successor. If you do not, they will not. Only if there are two simultaneous claims (e.g. Beijing versus Taipei) there might be trouble.