Stellar flares are a frequent occurrence on young low-mass stars around which many detected exoplanets orbit. Flares are energetic, impulsive events, and their impact on exoplanetary atmospheres needs to be taken into account when interpreting transit observations. We have developed a model to describe the upper atmosphere of Extrasolar Giant Planets (EGPs) orbiting flaring stars. The model simulates thermal escape from the upper atmospheres of close-in EGPs. Ionisation by solar radiation and electron impact is included and photo-chemical and diffusive transport processes are simulated. This model is used to study the effect of stellar flares from the solar-like G star HD 209458 and the young K star HD 189733 on their respective planets, HD 209458b and HD 189733b. The Sun is used as a proxy for HD 209458, and Eridani, as a proxy for HD 189733. A hypothetical HD 209458b-like planet orbiting the very active M star AU Microscopii is also simulated. We find that the neutral upper atmosphere of EGPs is not significantly affected by typical flares on HD 209458 and HD 189733. Therefore, stellar flares alone would not cause large enough changes in planetary mass loss to explain the variations in HD 189733b transit depth seen in previous studies, although we show that it may be possible that an extreme stellar proton event could result in the required mass loss. Our simulations do however reveal an enhancement in electron number density in the ionosphere of these planets, the peak of which is located in the layer where stellar X-rays are absorbed. Electron densities are found to reach 2.2 to 3.5 times pre-flare levels and enhanced electron densities last from about 3 to 10 hours after the onset of the flare, depending on the composition of the ionospheric layer. The strength of the flare and the width of its spectral energy distribution affect the range of altitudes in the ionosphere that see enhancements in ionisation. A large broadband continuum component in the XUV portion of the flaring spectrum in very young flare stars, such as AU Mic, results in a broad range of altitudes affected in planets orbiting this star. Indeed, as well as the X-ray absorption layer, the layer in which EUV photons are absorbed is also strongly enhanced.