What is going on is that the global variable a
of type A
is created first. In the construtor you output the text A is called
and than the program starts with the main funtion.
So what you see is to be expected and you take from it that prior to the execution of main()
global variables have to be created.
You can find more information if you look for static storage duration
, which global objects have.
NOTE: The order of creation of objects with static storage duration is unspecified by the standard, so any order can be observed.