add support for coercion on class type that inherit from Hash

This is the fix for issue #230