How this function get call on
cin>>d;
as it means cin.operator(d) as it pass on argument but function has accept two argument
As sir not declare it a friend function
How this function get call on
cin>>d;
as it means cin.operator(d) as it pass on argument but function has accept two argument
As sir not declare it a friend function
Hey Mayur, one thing is your are trying to overload << operator for istream, you can’t do that because we use >> operator for istream and << operator for ostream.
So for istream when you are overloading >> operator so whenever you use cin>> this function will be automatically get called.
Ok but to use this function is we have to declare a friend function or it get call directly
No there is no need to declare a friend function, by overloading the operator it will get automatically called when you use the corresponding operator.