I have a situation where I would like to compare an object encapsulated by a shared_ptr with the same type of object created on a stack. Currently, I'm getting the raw pointer and dereferencing it to do the comparison eg:
Object A;
std::shared_ptr<Object> B;
// assume class Object has its comparison operators overloaded
if ( *B.get() < A )
// do stuff here
Is there a better way to do this? That is assuming that when both objects meet to be compared with each other, one is a shared_ptr and the other is not.