This line:
Nested nes();
Does not create an object of type nes
, but rather declares a function which takes no arguments and returns an object of type Nested
. I suspect this to be the source of your problem, not the friend
declaration. Just remove the pair of parentheses after nes
:
Nested nes;
Alternatively, in C++11 you may do:
Nested nes{};
EDIT:
After fixing the above error, it still seems your program does not compile & link correctly - doubtfully because of the same problem. What I can tell from your code is that a definition of the some_method()
member function is still missing, and that may be a reason for the linker to refuse creating the executable for your program.