Although the aerofoil shape of an aircraft’s wing produces some of the lift in normal flight, the more important factor is the angle of attack, the angle at which the air strikes the wing.
The wings of an aircraft are normally inclined to about 4° to the horizontal when compared to the main body of the aircraft.
This is known as the chord angle of the wing.
So even when the fuselage is level, the angle of attack into the oncoming wind is 4°.
This produces lift in the same way that your hand experiences an upward force when you hold it at about 45° to the horizontal in a fast-moving stream of air.
Your hand does not have an aerofoil shape but the lift that you feel is caused by the angle of attack of your palm to the oncoming wind.
It is this principle that allows an aircraft to fly upside down.
The nose is pointed further upwards than in standard flight because of the need to offset the chord angle of the wing. But if the angle of attack is positive compared to the relative airflow over the wing, then an upward force will still be produced.
It is this lifting force which overcomes the force produced by the shape of the wing, and holds the aircraft in the air.
The bigger problem that pilots should be concerned about when flying their aircraft upside down is the risk of the engine stopping, because both the oil and fuel systems in most ordinary light aircraft are fed only by gravity.
Flying your aircraft upside down can easily cut off the fuel supply because the valve that is feeding fuel to the engine suddenly finds itself at the top of the tank.