Explain what is a friend class or a friend function
Show answer and explanation
A friend function or class receives access to private and protected members without becoming a member or base. Friendship is explicitly granted, is neither inherited nor transitive, and should be limited to collaborators that help maintain the invariant.
A friend function or class receives access to private and protected members without becoming a member or base. Friendship is explicitly granted, is neither inherited nor transitive, and should be limited to collaborators that help maintain the invariant.
Connect the conclusion directly to the type, lifetime, ownership, overload-resolution rule, or library contract present in the question. State implementation dependence or a violated precondition explicitly instead of merely guessing output.