Is there a difference between declaring a friend function/class as private or public? I can\'t seem to find anything about this online.
I mean the difference between
Since the syntax friend class B doesn't declare a member of the class A, so it doesn't matter where you write it, class B is a friend of class A.
Also, if you write friend class B in protected section of A, then it does NOT mean that B can access only protected and public members of A.
Always remember that once B becomes a friend of A, it can access any member of A, no matter in which section you write friend class B.