Relational operator overloading for enum class
<p>I got a problem while trying to overloading a less than operator for a enum class for experimental purpose, but surprisingly it only works for unary operators i.e. ++. The compiler complaints for ambiguity:</p>

<pre><code>enum class Fruit
{
    apple,
    banana,
    orange,
    pineapple,
    lemon,
};

bool operator&lt;(Fruit l, Fruit r) 
{
    return true;
}

int main()
{
    Fruit f = Fruit::banana;
    Fruit a = Fruit::apple;
    std::cout &lt;&lt; (a &lt; f);
}
</code></pre>

<p>Compiler obviously found another less than operator in global scope, but why it would not take the overloaded one for it's an exact match?</p>