Friend function part 1 | very very easy
Friend function: Friend function is not a member function of a class to which it is a friend. Friend function is declared inside the class with friend keyword. It must be defined outside the class to which it is friend. Friend function can access any member of the class to which it is a friend. Friend function can not access the members of the class directly. Friend function can not access members of the class directly because it has no caller object. It should not be defined with membership label. Let's consider a simple example to implement all above points: #include<iostream> using namespace std; class Complex{ private: int a, b; public: void setData(int x, int y){ a=x; b=y; } void showData(){ ...