I made a class Foo
for which I overloaded operators < > <= >= != and =
now I have these 2 codes, both should do same, but only 1 works:
This works:
Foo foo = Foo("1");
if (foo <= something->foo) { ...
This doesn't work:
if (Foo("1") <= something->foo) { ...
The error in second version is:
invalid operands to binary expression. Candidate function not viable: expects an l-value for 1st argument.`
What does it mean and why it doesn't work?