A census of AGB stars in Local Group galaxies - I. Photometry of a field in M 31