C++ Friend -- Friend Class - Can I make all its sub-classes also friends automatically?

Class A is a master "grandparent" class.
Class B inherits from Class A.
Class C inherits from Class B.

Class Tester{
  int private_int;
  friend class A;

Is there some way to give Classes B and C access to Class Tester's private members without also including "friend class B;" and "friend class C;"?

I would like the subclasses of Class A to inherit Class A's friend status with other classes.

Thanks in advance for your time.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

No, you need to explicitly declare each 'friend'. See also http://www.cplusplus.com/doc/tutorial/inheritance.html ("Friendship and inheritance"): "Another property of friendships is that they are not transitive: The friend of a friend is not considered to be a friend unless explicitly specified."

"C++ is where friends have access to your privates" ;o)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
oxygen_728Author Commented:
I think it is completely ridiculous that there isn't a transitive version.

Thanks for the info jkr, I don't think you're ridiculous =)
oxygen_728Author Commented:
jkr is my hero
Actually, it is fine the way it is. IMO friends should be used really sparsely, since it to some extent breaks OO principles. Yet sometimes you won't be able to completely avoid it.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.