79372285

Date: 2025-01-20 18:11:04
Score: 0.5
Natty:
Report link

In short, no.

From cppreference:

A defaulted comparison operator function is a non-template comparison operator function (i.e., <=>, ==, !=, <, >, <=, or >=) satisfying all following conditions:

  1. It is a non-static member or friend of some class C.
  2. It is defined as defaulted in C or in a context where C is complete.
  3. It has two parameters of type const C& or two parameters of type C, where the implicit object parameter (if any) is considered to be the first parameter.

You can't make the comparison operator a friend of a C structure to meet the 2nd criterion.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (0.5):
Posted by: Rud48