Added a hash macro to hash derived types

@simonlynen, I need this for types that are derived from hash id. Otherwise they won't compile as the key inside an unordered container.