You hit the most vexing parse. Change print p();
to print p;
.
print p()
is a declaration of a function named p
which returns a print object.
Also, in C++, an empty parameter list means a function taking no arguments (same as (void)
), which is why the compiler complains: " too many arguments in function call".