Does a friend see base classes?
问题 Given the sample code: class Base { public: bool pub; protected: bool prot; }; class Derived : private Base { friend class MyFriend; }; class MyFriend { Derived _derived; void test() { // Does standard provide me access to _derived.pub and _derived.prot? cout << "Am I allowed access to this: " << _derived.pub << " and this: " << _derived.prot; } }; Does being a friend give me all access I would get as if I was a member function within the class to which I am a friend? In other words, can I