[class.compare.secondary]

# 11 Classes [[class]](./#class)

## 11.10 Comparisons [[class.compare]](class.compare#secondary)

### 11.10.4 Secondary comparison operators [class.compare.secondary]

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/classes.tex#L6855)

A [*secondary comparison operator*](#def:secondary_comparison_operator "11.10.4 Secondary comparison operators [class.compare.secondary]") is
a relational operator ([[expr.rel]](expr.rel "7.6.9 Relational operators")) or the != operator[.](#1.sentence-1)

A defaulted operator function ([[over.binary]](over.binary "12.4.3 Binary operators"))
for a secondary comparison operator @ shall have a declared return type bool[.](#1.sentence-2)

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/classes.tex#L6863)

The operator function with parameters x and y is defined as deleted if

- [(2.1)](#2.1)

a first overload resolution ([[over.match]](over.match "12.2 Overload resolution")),
as applied to x @ y,
  * [(2.1.1)](#2.1.1)

does not result in a usable candidate, or

  * [(2.1.2)](#2.1.2)

the selected candidate is not a rewritten candidate, or

- [(2.2)](#2.2)

a second overload resolution for
the expression resulting from the interpretation of x @ y using the selected rewritten candidate ([[over.match.oper]](over.match.oper "12.2.2.3 Operators in expressions"))
does not result in a usable candidate
(for example, that expression might be (x <=> y) @ 0), or

- [(2.3)](#2.3)

x @ y cannot be implicitly converted to bool[.](#2.sentence-1)

In any of the two overload resolutions above,
the defaulted operator function is not considered as
a candidate for the @ operator[.](#2.sentence-2)

Otherwise, the operator function yields x @ y[.](#2.sentence-3)

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/classes.tex#L6892)

[*Example [1](#example-1)*: struct HasNoLessThan { };

struct C {friend HasNoLessThan operator<=>(const C&, const C&); bool operator<(const C&) const = default; // OK, function is deleted}; â *end example*]
