C++ friend inheritance?

SSight3 picture SSight3 · Sep 10, 2011 · Viewed 23.7k times · Source

Does a subclass inherit, the main class' friend associations (both the main class' own and other classes friended with the main class)?

Or to put it differently, how does inheritance apply to the friend keyword?

To expand: And if not, is there any way to inherit friendship?

I have followed Jon's suggestion to post up the design problem:
C++ class design questions

Answer

Jon picture Jon · Sep 10, 2011

Friendship is not inherited in C++.

The standard says (ISO/IEC 14882:2003, section 11.4.8):

Friendship is neither inherited nor transitive.