Friend function is a function, which can access the private and protected data member of a class. Using keyword friend, we can make function a friend function. Below is the prototype for friend function friend <return-type> function(<className>); Example: #include <iostream> using namespace std; class base { unsigned int m_int; public: base() { m_int = 20; } friend ostream& operator<<(ostream& s, const base& b); }; //Source File ostream& operator<<(ostream& s, const base& b) { s << b.m_int ; return s; } int main() { base b; cout << b << endl;…