Yes you can. A subtype is still of the same type of the base type.
Note, that because the in built functions have no knowledge of subtypes, the returned value (like C in this case) will be the base type. You will have to write your own function for it to return the subtype.