C++ friend function
If a function is defined as a friend function in C++ then the protected and private data of a class can be accessed using the function.
By using the keyword friend compiler knows the given function is a friend function.
For accessing the data, the declaration of a friend function should be done inside the body of a class starting with the keyword friend.
Declaration of friend function in C++
C++ friend function Example
Let's see the simple example of C++ friend function used to print the length of a box.
Length of box: 10