Classical justification of the photoelectric effect