This is simply a case of undefined behavior because the results of casting a pointer to a function to a pointer to object type are undefined.
A more interesting expression to examine would bef == f which should evaluate to true if and only if A and B refer to the same type.