Support for a cast operator (metafunction). Might still need some work, but seems reasonable so far.