Compiler cannot solve overloading for alias classes

In the following code I would say that the class Alias is an alias of class C. So it should not make a difference which one is used. The code below does however not type-check:

class C a where
    g :: a
class Alias a | C a

f :: a -> () | C a
f x = g x
where
    g :: a -> () | Alias a
    g _ = ()

g requires Alias for a, which only include C for a. C is provided by the context so this should type-check, I think.