Generalized polynomial identities and rings which are sums of two subrings