#include <iostream> struct B{}; struct A{friend B*foo(B*ptr){std::cout<<"impossible";return ptr;}}; int main(){ B*ptr; foo(ptr); A::foo(ptr); return 0; }
Standard input is empty
prog.cpp: In function 'int main()': prog.cpp:8:10: error: 'foo' was not declared in this scope foo(ptr); ^ prog.cpp:9:3: error: 'foo' is not a member of 'A' A::foo(ptr); ^
Standard output is empty