When you call an overloaded function or operator, the compiler determines the most appropriate definition to use, by comparing the argument types you have used to call the function or operator with the parameter types specified in the definitions.
What is operator overloading and how does it work?
Polymorphism: Polymorphism (or operator overloading) is a manner in which OO systems allow the same operator name or symbol to be used for multiple operations. That is, it allows the operator symbol or name to be bound to more than one implementation of the operator. A simple example of this is the “+” sign.
How is operator overloading done?
Operator overloading of member function
If you write an operator function as a member function, it gains access to all of the member variables and functions of that class. When overloading an operator using a member function: The overloaded operator must be added as a member function of the left operand.