Why does this code `misbehave`?
<pre><code>#include &lt;iostream&gt;
 using namespace std;

struct X
{
    int i_Val;

    X(int iVal)
        :i_Val(iVal)
    {
    }

    X&amp; operator++()
    {
        cout &lt;&lt; "X::operator++()" &lt;&lt; endl;

        ++i_Val;
        return *this;
    }

    operator int() const
    {
        return i_Val;
    }
};

const X operator+(const X&amp; lhs, const X&amp; rhs)
{
    cout &lt;&lt; "operator+(const X&amp;, const X&amp;)" &lt;&lt; endl;
    return lhs.i_Val + rhs.i_Val;
}

int main()
{
    X x = 5;
    X y = (++x) + (++x) + (++x);

    cout &lt;&lt; y &lt;&lt; endl;
}
</code></pre>

<p>compile and run. It produces the output:</p>

<pre><code>X::operator++()
X::operator++()
X::operator++()
operator+(const X&amp;, const X&amp;)
operator+(const X&amp;, const X&amp;)
24
</code></pre>

<p>But I expected this:</p>

<pre><code>X::operator++()
X::operator++()
operator+(const X&amp;, const X&amp;)
X::operator++()
operator+(const X&amp;, const X&amp;)
22
</code></pre>

<p>Who's at blame? Me or the compiler?</p>
