It occurred to me that in C++ it is possible to use the type std::optional. An object of this type is essentially a reference
The main difference between std::optional and T* is that with T* you have to think about who owns the memory that is pointed to.
If a function returns T* you have to know if you are responsible for freeing the memory or someone else is. That's not something you have to be concerned with when it's a reference.