Spherical accretion onto neutron stars and black holes