<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/97087>97087</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [clang] [C++20] Defaulted `operator==` doesn't lookup in using-directive properly
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          MitalAshok
      </td>
    </tr>
</table>

<pre>
    https://godbolt.org/z/c8v65nGzc

```c++
struct X {};
namespace NS {
    bool operator==(X, X);
}
using namespace NS;
struct Y {
    X x;
    friend bool operator==(Y, Y);
};
bool operator==(Y, Y) = default;
```

```
<source>:10:6: error: defaulting this equality comparison operator would delete it after its first declaration
   10 | bool operator==(Y, Y) = default;
      |      ^
<source>:7:7: note: defaulted 'operator==' is implicitly deleted because there is no viable 'operator==' for member 'x'
    7 |     X x;
      | ^
```

If it is defaulted in the class it does compile and properly call `NS::operator==(X, X)`: https://godbolt.org/z/M8Msc8T3a  
If the function-body is replaced it also compiles: https://godbolt.org/z/19sEre7KW
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVF1v6zYM_TX0C9HClmLLfvCD2zTDMHQvG7D2UZaYRLuK5UlydttfP8hJnS7I1hsoib7Icw5JUYZgdgNRC-UDlOtMTnHvfPtsorRd2LtvWe_0W7uPcQzAO2AbYJud072z8d75HbDNO7CNqo9VOfz0riBfQ96df6v8NBSwhzTm3RD9pCK-IIgHEGvg5_1BHiiMUhH--tt8Nu8iIvbOWXQjeRmdB75Og9UvwB7xBVizeEje5skUzLDDzw6XO2f0138jvOD35UZab72hQf8H8GsCfr0G_ph_YYPA16hpKycbL_YfgboZvfOSPwY3eUXAn4B3RQ68q4B3SN4noO7Da5Ie9yYg_TVJa-IbKncYpTfBDQsx_NtNVqMmS5HQRJTbSB5NDLg1PkTUpKz0Mho3LGEpcgTx-FVUbirE-ZOsT5Py6aYqcf7i4CJ90kQagYlrTIEmoDmM1igT7dtZjcaelJwCYdyTp3RncHg0srd028vWeTzQoSefzr8DExfSYiF9XSMnORclt3L48zbF1oRPOsyQeKGyMoR0qB2FOUPGEspB4-gTQ_uGSlqLUOWpejvg3f-8gCpVA371SJ_r56Dq37lEXOglLttpUCnRd-mpJ7aeRitVIhtR2uA--IUfQSma8ORJ_PJHpluuG97IjNpCFE3ZlLxZZftW1EVei7pmdb-SipjSsqGilqu6rLSgIjMty9kqr1hdCMYLfq8rVsuG9bVmMpcrBqucDtLYe2uPh4SdmRAmahuR1yKzsicb5o7GmLJy2AFjqbn5Nt2_66ddgFVuTYjh4iGaaOc2eLIo1wjlw-Opc7E8rdeXYqzyq2xU-ZzJAZiIaJ37No0p1XMnutPGk4rmSEtys8nb66Zq4n7q75U7ANskVue_u9G7P0lFYJtZZAC2Oek8tuyfAAAA__8le7HQ">