No, there is no standard solution. Equality operator shared_ptr, etc. compares only pointers, not managed objects. Your decision is in order. I suggest this version, which checks if the pointed object is the same, and returns false if one of the common pointers is null and the other is not:
template<class T, class U> bool compare_shared_ptr(const std::shared_ptr<T>&a,const std::shared_ptr<U>&b) { if(a == b) return true; if(a && b) return *a == *b; return false; }
source share