Google Test can't find user provided equality operator
<p>I'm using Google Test v1.7 </p>

<p>I've created a custom <code>operator ==</code> which <code>ASSERT_EQ</code> can't find, but which can be found if used directly.  Here's the code</p>

<pre><code>#include &lt;vector&gt;
#include &lt;deque&gt;

#include "gtest/gtest.h"

template&lt; typename T&gt; struct bar { T b; };

template&lt; typename T&gt;
bool operator == ( const std::vector&lt;T&gt;&amp; v, const bar&lt;T&gt;&amp; b ) { return false; }

template&lt; typename T&gt;
bool operator==(  const std::vector&lt;T&gt;&amp; v , const std::deque&lt;T&gt;&amp; d) { return false; }

TEST( A, B ) {

    std::vector&lt;char&gt; vec;
    std::deque&lt;char&gt; deq;
    bar&lt;char&gt; b;

    // compiles
    ASSERT_EQ( vec, b );

    // compiles
    vec == deq;

    // doesn't compile
    ASSERT_EQ( vec, deq );
}
</code></pre>

<p>The <code>ASSERT_EQ( vec, deq )</code> line results in the following message from Apple 6.0 clang:</p>

<pre><code>test/gtest.h:18861:16: error: invalid operands to binary expression ('const std::__1::vector&lt;char, std::__1::allocator&lt;char&gt; &gt;' and 'const
      std::__1::deque&lt;char, std::__1::allocator&lt;char&gt; &gt;')
  if (expected == actual) {
      ~~~~~~~~ ^  ~~~~~~
../x86_64-linux_debian-7/tests/gtest/gtest.h:18897:12: note: in instantiation of function template specialization 'testing::internal::CmpHelperEQ&lt;std::__1::vector&lt;char,
      std::__1::allocator&lt;char&gt; &gt;, std::__1::deque&lt;char, std::__1::allocator&lt;char&gt; &gt; &gt;' requested here
    return CmpHelperEQ(expected_expression, actual_expression, expected,
           ^
tst.cc:27:5: note: in instantiation of function template specialization 'testing::internal::EqHelper&lt;false&gt;::Compare&lt;std::__1::vector&lt;char, std::__1::allocator&lt;char&gt; &gt;,
      std::__1::deque&lt;char, std::__1::allocator&lt;char&gt; &gt; &gt;' requested here
        ASSERT_EQ( vec, deq );
        ^
</code></pre>

<p>while gcc 4.7.2 lists all of the templates it tried and failed to make <code>expected == actual</code> work, ignoring the one I provided.</p>

<p>What I don't understand is why </p>

<ul>
<li><code>ASSERT_EQ( vec, b )</code> finds the provided <code>operator ==</code>; and</li>
<li><code>vec == deq</code> compiles; but</li>
<li><code>ASSERT_EQ( vec, deq )</code> doesn't.</li>
</ul>

<p>Could someone please shine some light on this?  It's got to be something blazingly obvious, but I can't see it.</p>