 Hello friends, I am Sanjay Gupta. In this video, I am going to demonstrate you how you can apply binary operator overloading using friend function. Before starting, you can move my information. You can connect with me by following these details which are available in front of you. You can download my app, Techimus, that is available on Google Play. This app is based on programming languages. Now, I am going to implement a code for you for demonstrating binary operator overloading using friend function. So, first I am including a header file that is iostream. Then I am using a namespace std, name of classes complex. Here two attributes are declared R and I, R for real and I for imaginary. Then in public section, I am implementing first function that is read. I am implementing cout which will display a message, enter real and imaginary value. This message will be displayed on console. Entered values will be stored inside R and I variables. Now, I am implementing print function which will display real equals to message on console followed by real value. Then and then imaginary equals to value of i and again and and is for line termination. It stands for and line. Now, with the help of friend keyword, I am going to implement plus operator overloaded function. So, return type of this function will be complex, then operator keyword, then plus symbol. Now, this definition will receive two arguments. First one is C1 and second one C2. So, as I am implementing this plus overloaded function definition using friend function. So, friend function says that you cannot pass any implicit arguments inside friend function. All the arguments will be passed explicitly. So, plus is binary operator. It requires two arguments. If we implement binary operator overloading without using friend function, then one becomes implicit and one becomes explicit. But in this case, while I am implementing friend concept, all those arguments will be explicit and these explicit arguments will receive inside C1 and C2. Now, I am creating a temporary object T and I am adding these values like this. T dot R equals to C1 dot R plus C2 dot R. T dot I equals to C1 dot I plus C2 dot I. So, both the complex numbers are added and stored inside the object. Now, I am returning T through this function. So, this is the complete implementation of this class. Now, I am implementing main function. Inside main function, I am going to create three objects complex C1, C2 and C3. Now, I am calling read function for C1 again read function for C2. Then, I am calling plus overloaded function. Here, C3 equals to C1 plus C2 is written. So, C1 and C2 both are arguments and these two arguments will be passed explicitly inside these two formal parameters. And the result will be stored inside T which will be further received inside C3. Now, to display the result, I am calling print function and then return 0. So, this is the complete implementation of this program which is adding two complex numbers by overloading plus operator using the concept of print function. Now, I am executing this code. It is asking for real and imaginary values. I am entering 2 and 2 and 5 and 5. You can see the output real equals to 7 and imaginary equals to 7. This is the addition of first and second complex number. So, friends, I hope you have understood how you can implement binary operator overloading using print function. If you are doing so, you have to remember that all implicit arguments must be passed explicitly and they must be received inside formal parameters which are available in function definition. If you want to watch more programming related videos, you can subscribe my YouTube channel that is Sanjay Gupta underscore Tech School. Thank you for watching this video.