Hole localization and superconductivity in La2CuO4+δ