Charm and beauty production in photon-photon collisions