to_v4() gives wrong result for ip::address

When using to_v4() on an ip::address_v6 which contains a valid ipv4
address to_v4() returns a valid ip::address_v4.
Doing the same on a ip::address which holds an IPv6 address gave a bad
cast exception.
The fix is to call to_v4() on the ipv6_address_ if it contains an ipv6
address.