title: Difference between a pointer to a standalone and a friend function
body: <p>I don't understand why the following does not compile (e.g. in gcc 9.10 or MS VS C++ 2019):</p>
  <pre><code>class X {
    public:
      friend bool operator==(int, X const &amp;);
  };
  
  int main() {
    2 == X();  // ok...
    static_cast&lt;bool (*)(int, X const &amp;)&gt;(&amp;operator==);  // Error: 'operator==' not defined
    return 0;
  }
  </code></pre>
  <p>but the following code is compiled without any issues:</p>
  <pre><code>class X {
    public:
  };
  bool operator==(int, X const &amp;);
  
  int main() {
    2 == X();  // ok...
    static_cast&lt;bool (*)(int, X const &amp;)&gt;(&amp;operator==);  // OK!
    return 0;
  }
  </code></pre>
  <p>My expectation is that a friend function (operator==) of X behaves as a standalone function (operator==). What I'm missing? Thanks</p>