Why is implicit conversion not ambiguous for non-primitive types? : <p>Given a simple class template with multiple implicit conversion functions (non-explicit constructor and conversion operator), as in the following example:</p>

<pre><code>template&lt;class T&gt;
class Foo
{
private:
    T m_value;

public:
    Foo();

    Foo(const T&amp; value):
        m_value(value)
    {
    }

    operator T() const {
        return m_value;
    }

    bool operator==(const Foo&lt;T&gt;&amp; other) const {
        return m_value == other.m_value;
    }
};

struct Bar
{
    bool m;

    bool operator==(const Bar&amp; other) const {
        return false;
    }
};

int main(int argc, char *argv[])
{
    Foo&lt;bool&gt; a (true);
    bool b = false;
    if(a == b) {
        // This is ambiguous
    }

    Foo&lt;int&gt; c (1);
    int d = 2;
    if(c == d) {
        // This is ambiguous
    }

    Foo&lt;Bar&gt; e (Bar{true});
    Bar f = {false};
    if(e == f) {
        // This is not ambiguous. Why?
    }
}
</code></pre>

<p>The comparison operators involving primitive types (<code>bool</code>, <code>int</code>) are ambiguous, as expected - the compiler does not know whether it should use the conversion operator to convert the left-hand template class instance to a primitive type or use the conversion constructor to convert the right-hand primitive type to the expected class template instance.</p>

<p>However, the last comparison, involving a simple <code>struct</code>, is not ambiguous. Why? Which conversion function will be used?</p>

<p>Tested with compiler msvc 15.9.7.</p>
