Added a hash macro to has 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.