Declare a member-function of a forward-declared class as friend
问题 Is it possible to declare a member function of a forward-declared class as friend? I am trying to do the following: class BigComplicatedClass; class Storage { int data_; public: int data() { return data_; } // OK, but provides too broad access: friend class BigComplicatedClass; // ERROR "invalid use of incomplete type": friend void BigComplicatedClass::ModifyStorage(); }; So the goal is to (i) restrict the friend declaration to a single method, and (ii) not to include the definition of the