Photovoltage inversion effect and its application to semiconductor surface studies: CdS