The problem is the std::endl but I am puzzled why your overload is a better match than the one from std::basic_ostream::operator<<, see godbolt live example:
:29:12: note: in instantiation of template class 'std::variant<>' requested here
<< std::endl;
^
and removing the std::endl indeed fixes the problem, see it live on Wandbox.
As alfC points out altering your operator to disallow an empty variant does indeed fix the issue, see it live: