Stone-Weierstrass complex theorem

I have already proven the real version of this theorem:

If $X$ is a compact metric space. Let $\mathcal{C}(X) := \left(\mathcal{C}(X, \mathbb{R}),\Vert.\Vert_{\infty} = \Vert .\Vert\right)$ $\mathcal{A}$ is a separating subalgebra of $\mathcal{C}(X)$, and $1 \in \mathcal{A}$, then $\overline{\mathcal{A}}= \mathcal{C}(X)$ (where the closure is taken with respect to the uniform metric)

My university book now proves the complex version, given this version:

Let $X$ be a compact metric space, $\mathcal{A}$ a separating subalgebra of $\mathcal{C}(X, \mathbb{C})$ with $1 \in \mathcal{A}$ and for $f \in \mathcal{A}$, also $\overline{f} \in \mathcal{A}$. Then $\overline{\mathcal{A}} = \mathcal{C}(X, \mathbb{C})$

Note that I did not take a course of complex analysis (yet).

The proof my book provides is the following:

Proof: For $f \in \mathcal{A}$, we have $Re(f) = \frac{f + \overline{f}}{2},Im(f) = \frac{f - \overline{f}}{2i} \in \mathcal{A}$. Let now $\mathcal{A_0}$ be the real subalgebra of the real valued functions. Then this subalgebra contains $1$, is separating and is a subset of $C(X)$. Hence, by the real version of Stone-Weierstrass theorem, it follows that $\overline{\mathcal{A_0}} = \mathcal{C}(X)$. Because for real valued functions $f,g,u,v$, we have that:

$$\Vert (u+iv) - (f+ig) \Vert \leq \Vert f-u \Vert + \Vert g - v \Vert$$

and $\mathcal{C}(X, \mathbb{C}) = \mathcal{C}(X) + i\mathcal{C}(X)$ and $\mathcal{A} = \mathcal{A_0} + i \mathcal{A_0}$, it follows that $\mathcal{A}$ is dense in $\mathcal{C}(X, \mathbb{C})$ for the uniform topology. $\square$

My interpretation of this proof is:

We clearly have $\overline{\mathcal{A}} \subset \mathcal{C}(X, \mathbb{C})$, so let's prove the other inclusion.

Let $h \in \mathcal{C}(X, \mathbb{C}) = \mathcal{C}(X) + i\mathcal{C}(X)$. Then there are real valued functions $f,g$ such that $h = f+ig$.

Consider the subalgebra $\mathcal{A_0}:= \{f \in \mathcal{A} \mid f(X) \subseteq \mathbb{R}\} \subseteq \mathcal{C}(X)$. Clearly, $1$ is contained in this algebra and it can be verified that this is separating.

Let $\epsilon > 0$. Because $\overline{\mathcal{A_0}} = \mathcal{C}(X)$, we can find real valued functions $f',g'$ such that $\Vert f' - f \Vert < \frac{\epsilon}{2}$ and $\Vert g' - g \Vert < \frac{\epsilon}{2}$

Define then $h' := f' + ig'$. Then, we have:

$\Vert h - h'\Vert = \Vert f-f' + (g-g')i\Vert \leq \Vert f-f'\Vert + \Vert g - g' \Vert < \epsilon$

Hence, $h' \in B(h, \epsilon)$

And it is here I get stuck. I have to show that $h' \in \mathcal{A}$, in order to conclude that $h' \in B(h, \epsilon)\cap \mathcal{A}$,such that $h \in \overline{\mathcal{A}}$.

So here are my questions:

Is my proof (until the point I get stuck) correct? Where do we use the line (from the original proof):

For $f \in \mathcal{A}$, we have $Re(f) = \frac{f + \overline{f}}{2},Im(f) = \frac{f - \overline{f}}{2i} \in \mathcal{A}$

How can I complete the proof? I.e., show that $h' \in \mathcal{A}$

What you have so far is correct. You use the fact that $\mathcal{A}$ contains the real and imaginary parts of its elements to deduce that $\mathcal{A}_0$ is dense in $\mathcal{C}(X)$, since that is needed to conclude that $\mathcal{A}_0$ is separating from the assumption that $\mathcal{A}$ is separating.
You complete your proof by using that $\mathcal{A}$ is a subalgebra of $\mathcal{C}(X,\mathbb{C})$, in particular it is a complex linear subspace, so
$$f',g' \in \mathcal{A}_0 \subset \mathcal{A} \implies h' = f' + i g' \in \mathcal{A}\,.$$