It seems like there is no proper way to do what I wanted to do. I have decided to just write separate specializations for each derived class, using the following macro:
// macro to conveniently define specialization for a class derived from Hashable
#define DEFINE_STD_HASH_SPECIALIZATION(hashable) \
namespace std { \
template<> \
struct hash<hashable> { \
std::size_t operator()(const hashable& object) const { \
return object.Hash(); \
} \
}; \
}
and then
// specialization of std::hash for Derived
DEFINE_STD_HASH_SPECIALIZATION(Derived);