The letters A, E, I, O, and U are often referred to as vowels, with the other 21 letters being referred to as consonants.
In speech, however, it is sounds, not letters, that are important in deciding whether we are dealing with vowels or consonants. The choice of a or an depends on the first sound in a word. The sound /j/, the first sound in, for example, yard, year, yellow, is treated as a consonant. In all words beginning with eu and some with u, the first sound is /j/.
That is why we say and write a university, a united front, a European, a eulogy.
When we use a or an before the names of letters, the choice also depends on the first sound of the name of the letter. So:
an A, E, F, H, I, L, M, N, O, R, S, X
a B, C, D, G, J, K, P, Q, T, U, V, W,Y, Z
a NATO member – NATO is pronounced /neɪtəʊ/
an EU member – EU is pronounced /iː juː/
Note that when H is the first letter of a word, it is usually pronounced as a consonant, /h/, as in house, home, hand. However, in a small number of words beginning with H, for example, herb (AmE only), honest, honour (BrE). honor (AmE), hour, the H is silent, and the words begin with a vowel sound. So, we say and write an hour, an honest man.
ps My blunder has now been corrected. Thanks. tzfujimino.