In class diagrams, a permission relationship is a relationship in which a class allows another class to have visibility to its encapsulated attributes or operations.
In C/C++ a special relationship allows one class to give permission to another class to access its private data area. The class that has been given permission becomes a friend to the sharing class. A class that is a friend to another class has access to all the data and methods of the sharing class.
For example, a Customer class gives permission to an Account class so that the Account class can use personal information about the customer. The Account class becomes a friend to the Customer class. This relationship makes it easier for the Account class to perform its tasks because it has access to the Customer class.
As the figure in the following table illustrates, a permission relationship is shown by a dashed line connector between classes with an open arrowhead that points to the friend class, or the class that has permission to access the private data and methods of the sharing class.
C/C++ source code | UML visualization |