A defaulted comparison operator function ([over.binary])
for some class C
shall be a non-template function
declared in the member-specification of C
that is

- a non-static const member of C having one parameter of type const C&, or
- a friend of C having either two parameters of type const C& or two parameters of type C.

A defaulted comparison operator function for class C
is defined as deleted if
any non-static data member of C is of reference type or
C is a union-like class ([class.union.anon]).

If the class definition
does not explicitly declare an == operator function,
but declares a defaulted three-way comparison operator function,
an == operator function is declared implicitly
with the same access as the three-way comparison operator function.

The implicitly-declared == operator for a class X
is an inline member and is defined as defaulted in the definition of X.

If the three-way comparison operator function
is declared as a non-static const member,
the implicitly-declared == operator function is a member of the form

bool X::operator==(const X&) const;

Otherwise, the implicitly-declared == operator function is of the form

friend bool operator==(const X&, const X&);

[ Note

The operator is a constexpr function if its definition
would satisfy the requirements for a constexpr function.: Such a friend function is visible
to argument-dependent lookup ([basic.lookup.argdep])
only ([namespace.memdef]). — *end note*

]The direct base class subobjects of C,
in the order of their declaration in the base-specifier-list of C,
followed by the non-static data members of C,
in the order of their declaration in the member-specification of C,
form a list of subobjects.

In that list, any subobject of array type is recursively expanded
to the sequence of its elements, in the order of increasing subscript.

Let be an lvalue denoting the element
in the expanded list of subobjects for an object x
(of length n),
where is
formed by a sequence of
derived-to-base conversions ([over.best.ics]),
class member access expressions ([expr.ref]), and
array subscript expressions ([expr.sub]) applied to x.

It is unspecified whether virtual base class subobjects
appear more than once in the expanded list of subobjects.