Excitons in quantum wells with a two-dimensional electron gas