If by adding two colour values with alpha you mean to combine them for the purposes of blending then here's the answer you need. I'll show the full derivation too.
Feel free to scroll down to the TL;DR indicator if you're in a hurry.
Luminance-alpha formats
Let’s simplify this by considering an image using the monochrome luminance-alpha format. Pixels in this format have two components: a luminance value (L), ranging from 0.0 to 1.0, and an alpha component (α) also ranging from 0.0 to 1.0.
Blending
Pixels with alpha components typically support a blend operation. Let’s use the symbol ⊕ to denote the blend operation. This operator takes as its left-hand side operand, a single-channel luminance-only value that is “opaque” (no alpha). But the right-hand side operand takes a two-channel luminance-alpha pixel. And this operator outputs a single-channel luminance-only value.
Let’s suppose we start with a pixel value B stored in the framebuffer. You can also think of it as the “background” value onto which we can blend new semi-transparent luminance-alpha pixels.
Let’s assume as want to blend a semi-transparent luminance-alpha pixel value P over top of that and write the resultant value back into the framebuffer. We are “painting” onto the background. You could think of this as modifying B, but we’ll write the new value of B as B’.
B’ = B ⊕ P
The definition of ⊕ looks like this:
BL' = BL (1 - Pα) + PL Pα
This says that the output is the luminance value in the buffer (background) times one-minus-alpha, plus the semi-transparent luminance value times alpha. This should be an alpha blending operation you’re familiar with.
Composing two blend operations
One way to consider how to combine two semi-transparent pixel values, P and Q is to construct a new value R (standing for “result”) such that:
(B ⊕ P) ⊕ Q = B ⊕ R
What I’ve written there, is that we perform two distinct, successive, blend operations one after the other. First, we blend P with the background B to arrive at (B ⊕ P) then we blend Q with that result to arrive at (B ⊕ P) ⊕ Q. Furthermore, we’d like this two-step operation to be equivalent to a one-step operation of blending a single semitransparent pixel R with the original background B.
Now we can define R in terms of an “alpha compose” operator of our own design that operates on P and Q, for which we will use the symbol ⊙, and we will define it to work like this
R = P ⊙ Q
We want to define it such that:
(B ⊕ P) ⊕ Q = B ⊕ (P ⊙ Q)
If we simply expand the definitions of these operators as before in terms of modifying a background pixel, then we’d like to define B’’ which is the result of having blended Q over B’. And recall that B’ was the result of having blended P over the background B.
B'' = (B ⊕ P) ⊕ Q
B'' = B' ⊕ Q
Derive the formula
Here's the show your work portion.
We can substitute (B ⊕ P) with what we’ve shown B’ to be equal to.
BL'' = (BL (1 - Pα) + PL Pα) ⊕ Q
And now we can keep expanding to show what happens after we blend Q with that intermediate result. This gets a little cluttered, but it equals this:
(BL (1 - Pα) + PL Pα)(1 - Qα) + QL Qα
We want to rearrange this to be of the form of the original blend operator definition.
Let’s start by simplifying:
(BL - BL Pα)(1 - Qα) + PL Pα (1 - Qα) + QL Qα
BL - BL Pα - BL Qα + BL Pα Qα + PL Pα - PL Pα Qα + QL Qα
And now remember it has to end up looking like this:
BL (1 - Rα) + RL Rα
Let’s rearrange to accomplish that:
BL (1 - (Pα + Qα - Pα Qα)) + PL Pα - PL Pα Qα + QL Qα
We now know that:
Rα = Pα + Qα - Pα Qα
We just need to figure out what RL equals.
We know from what’s left over in that equation that:
RL Rα = PL Pα - PL Pα Qα + QL Qα
And therefore, if Rα is non-zero, we can divide to isolate RL.
RL = (PL Pα - PL Pα Qα + QL Qα)/Rα
Substituting the value we arrived at for Rα we get:
RL = (PL Pα - PL Pα Qα + QL Qα)/(Pα + Qα - Pα Qα)
This is an expression entirely in terms of components of P and Q, which means we're done. And the final definition you've been waiting for is written below...
TL;DR (here's the answer you want)
Given R = P ⊙ Q, we can define the alpha compose operator ⊙ such that:
Rα = Pα + Qα - Pα Qα
RL = (PL Pα + QL Qα - PL Pα Qα)/Rα
Note that our formula for RL is only valid in the case when the alpha values of P and Q are not both zero. That’s because if the alpha is zero, then the luminance channel can be anything. Therefore, in the case where Rα is zero, we can simply define RL also to be zero.
Now fortunately, for an RGBA format pixel, by symmetry, we can simply substitute the name “red”, “green” or “blue” for the “luminance” channel in the formulae we derived above. The RGB streams never cross; the values don’t contaminate each other. You can work with each colour channel independently. The red component of a composite operation obviously depends on the red components of both P and Q, but it doesn’t depend on the green or blue channels of the either pixel, but it does depend on the alpha value of both pixels. Simply substitute L above with R G or B for RGBA formats.
Important: order matters!
I want to take a moment to observe that the expression for Rα has some symmetry, in that it doesn’t seem to matter whether P or Q happens first. But the expression for RL lacks this symmetry. There’s a term -PL Pα Qα that is unbalanced and has a Luminance contribution from P but not Q. So, this is a big warning that the composition operator we have defined is not commutative.
P ⊙ Q ≠ Q ⊙ P
This means that the order in which we blend pixels matters. More fundamentally, the same thing can be expressed as:
(B ⊕ P) ⊕ Q ≠ (B ⊕ Q) ⊕ P
It matters whether you blend P first and then Q second, vs blending Q first and blending P second. In this regard, the composition operation is unlike regular addition or multiplication where a + b = b + a.