Ok, I guess I know the answer to my question: If there is a library class B0, which has protected members (not meant to be used by library user).
If derived class would be an auto-friend to base class, then the user could cheat his way to protected members, by inheriting a B1 class from B0, and accessing the protected members of B0 from within B1. The idea behind protection is to enforce users of library classes to not use protected members. On the other hand, a class quite often need to be friend of itself so it is justified. Although I wouldn't have defaulted auto-friend to itself though. Topi --- In c-prog@yahoogroups.com, "topimaurola" <yahoo....@...> wrote: > > I did intent it the ways it was. > > The idea was: > > 1. Why the inherited class isn't a friend of master class as a default. I see > that it is not (by standard), but is there a rationale to make standard such? > > 2. Why the class is friend of itself, by default (as it cannot be revoked, I > guess). This is by standard, too, but is there a rationale behind? > > 3. Why 1) and 2) are different? is the main point. The inherited class should > be (from my feeling) be an extension of base class, with similar rights, but > that seems not to be the case. > > I have a real-case where a derived-class object is trying to modify another > object of reference to base class, and it cannot access protected members. > Similar code in base class works fine. > > Topi >