Indefinite article [duplicate]

If the rule about the indefinite article is:

'a' is used before nouns starting with a consonant.

Why is 'an' used in the following sentence:

I want to work in an outstanding company.


Solution 1:

The rules are based on pronunciation and not on spellings.

'a' is used before 'consonant sound' not before actual consonant. 'an' is used before 'vowel sound' not before actual vowel.

Like below, the words start with the same letter but are preceded by different articles:

'E' with consonant sound

a eulogy

'E' with vowel sound

an edge