Ask your AI Ask your AI to turn this code into a guided bug-finding exercise.
Claude ChatGPT I am reading "Why can an expression a + b find operator+ defined as a friend inside the class of a and b?" on CodeWiki (https://codewiki.com/practice/mcq/cpp/operator-overloading/hidden-friend-lookup/).
Context (verbatim from the page):
"""
Why can an expression a + b find operator+ defined as a friend inside the class of a and b?
Argument-dependent lookup adds the hidden friend as a candidate.
Every friend function is a private member function.
The compiler searches every class definition in the program.
friend changes the operator into a built-in operation.
"""
Introduce three subtle bugs into the example above and let me find them. Reveal each answer only after I have guessed.
Answer in English. Keep code examples in C++. Where you are unsure, say so.