Cross-correlation of spectroscopic and photometric galaxy surveys: cosmology from lensing and redshift distortions