Friends?





Declaring a friend Function

class AClass { friend bool JTaylor (int, double) ; public: // ... more stuff ... private: int priv_data ; } ;



Declaring a friend Class

class AClass { friend class AnotherClass ; friend bool YetAnotherClass::func(int) ; public: // ... more stuff ... private: int priv_data ; } ;





Mutual Friends





Mutual Class Friends

class YetAnotherClass ; // forward declaration class AClass { friend class YetAnotherClass ; // ... more stuff ... } ; class YetAnotherClass { friend class AClass ; // ... more stuff ... } ;