Why didn't we overload == directly

Hi, why didnt we directly overload operator == using the function operator overload.
Something like:
//comparator using operator overloading
bool operator == (Book &x, Book &y)
{
if(x.getName()==y.getName())
{
cout<<“Found”;
}
else
{
cout<<“Not found”;
}
}

Is there any benefit in the class BookCompare method used by Prateek bhaiya?

@varun.saxena,
Did you try compiling this?

Yes, it worked. I tried out solve the same problem as in the lecture using this method and was able to.
Thus, wanted to know why this wasn’t directly used, is there a problem with this.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

But, you haven’t answered the question yet!!!
My doubt still exists.

@varun.saxena,
There is no problem, you can use any method you feel comfortable with.