Heavy-quark production in two-photon collisions