#include <boost/noncopyable.hpp> class Key{ friend class Copain; Key() {} Key(Key const&) {}}; void semiprivate(Key) {} struct Copain{ Key key; void test() { semiprivate(key); }}; void other() { Copain c; semiprivate(c.key);} int main(){}
Standard input is empty
prog.cpp: In function ‘void other()’: prog.cpp:7: error: ‘Key::Key(const Key&)’ is private prog.cpp:24: error: within this context prog.cpp:24: error: initializing argument 1 of ‘void semiprivate(Key)’
Standard output is empty
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!