What's the most convenient way to be able to store either std::shared_ptr or Foo* in the same type?
Foo* a = ...;
std::shared_ptr<Foo> b = ...;
Bar c = a; // Success, Bar type can hold Foo*
Bar d = b; // Success, Bar type can also hold std::shared_ptr<Foo>
std::variant<Foo*, std::shared_ptr< Foo>> is okay, but it's not possible to dereference it directly and that is kind of annoying. Is there a better way?