First measurement of the photon structure function F2