Question: what are the merits and demerits of using friend function in c++?
Answer: It acts as the bridge between two classes by operating on their private data's. It is able to access members without need of inheriting the class. It can be used to increase the versatility of overloading operator. It provides functions that need data which isn't normally used by the class.