Optically visible post-AGB/RGB stars and young stellar objects in the small magellanic cloud: Candidate selection, spectral energy distributions and spectroscopic examination