https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99599
--- Comment #26 from Jonathan Wakely <redi at gcc dot gnu.org> ---
What's bizarre about the PR 104606 case is that this fixes it:
--- a/libstdc++-v3/include/std/optional
+++ b/libstdc++-v3/include/std/optional
@@ -1431,7 +1431,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#ifdef __cpp_lib_three_way_comparison
template<typename _Tp, typename _Up>
requires (!__is_optional_v<_Up>)
- && three_way_comparable_with<_Tp, _Up>
+ && three_way_comparable_with<_Up, _Tp>
constexpr compare_three_way_result_t<_Tp, _Up>
operator<=>(const optional<_Tp>& __x, const _Up& __v)
{ return bool(__x) ? *__x <=> __v : strong_ordering::less; }