The correlation function of galaxy ellipticities produced by gravitational lensing