The article a is used before consonant sounds; an is used before vowel sounds.
Words beginning with h, o and u sometimes begin with a vowel sound, sometimes a consonant sound.
Consonant Sound: a heroic couplet (h sound)
a once-happy lover (w sound)
a universal problem (y sound)
Vowel Sound: an honest man (no h sound)
an only child (o sound)
an unusual insect (u sound)