[proofplan]
A class function is exactly a function that assigns one complex number to each [conjugacy class](/page/Conjugacy%20Class). We make this precise by choosing, for every conjugacy class $C \in \operatorname{Cl}(G)$, its indicator function $\mathbb{1}_C: G \to \mathbb{C}$. These indicator functions span all class functions, and they are linearly independent because evaluating a linear relation at an element of a fixed class isolates exactly one coefficient.
[/proofplan]
[step:Define the indicator functions of the conjugacy classes]
For each conjugacy class $C \in \operatorname{Cl}(G)$, define the function
\begin{align*}
\mathbb{1}_C: G &\to \mathbb{C} \\
g &\mapsto
\begin{cases}
1, & g \in C,\\
0, & g \notin C.
\end{cases}
\end{align*}
Since conjugacy classes are invariant under conjugation, if $g,h \in G$ and $g \in C$, then $hgh^{-1} \in C$. Likewise, if $g \notin C$, then $hgh^{-1} \notin C$, because otherwise $g = h^{-1}(hgh^{-1})h$ would belong to $C$. Hence
\begin{align*}
\mathbb{1}_C(hgh^{-1}) = \mathbb{1}_C(g)
\end{align*}
for all $g,h \in G$, so $\mathbb{1}_C \in \operatorname{CF}(G)$.
[/step]
[step:Show that the class indicators span all class functions]
Let $f \in \operatorname{CF}(G)$. For each conjugacy class $C \in \operatorname{Cl}(G)$, choose an element $g_C \in C$, and define $a_C := f(g_C) \in \mathbb{C}$. We claim that
\begin{align*}
f = \sum_{C \in \operatorname{Cl}(G)} a_C \mathbb{1}_C.
\end{align*}
This sum is finite because $G$ is finite, hence $\operatorname{Cl}(G)$ is finite.
To verify the equality, fix $g \in G$. There is a unique conjugacy class $C_g \in \operatorname{Cl}(G)$ such that $g \in C_g$. Since $g$ and $g_{C_g}$ lie in the same conjugacy class, there exists $h \in G$ such that $g = h g_{C_g} h^{-1}$. Because $f$ is a class function,
\begin{align*}
f(g) = f(h g_{C_g} h^{-1}) = f(g_{C_g}) = a_{C_g}.
\end{align*}
On the other hand,
\begin{align*}
\sum_{C \in \operatorname{Cl}(G)} a_C \mathbb{1}_C(g) = a_{C_g},
\end{align*}
because $\mathbb{1}_{C_g}(g)=1$ and $\mathbb{1}_C(g)=0$ for every $C \neq C_g$. Therefore the displayed expansion holds for every $g \in G$, so the set $\{\mathbb{1}_C : C \in \operatorname{Cl}(G)\}$ spans $\operatorname{CF}(G)$.
[guided]
The point of this step is to turn the phrase “constant on conjugacy classes” into a basis expansion. Let $f \in \operatorname{CF}(G)$. For each conjugacy class $C \in \operatorname{Cl}(G)$, choose one representative element $g_C \in C$, and define the scalar $a_C := f(g_C) \in \mathbb{C}$. This scalar is meant to be the value of $f$ on the whole class $C$.
We claim that
\begin{align*}
f = \sum_{C \in \operatorname{Cl}(G)} a_C \mathbb{1}_C.
\end{align*}
The sum is finite because $G$ is finite, so there are only finitely many conjugacy classes.
Now fix an arbitrary element $g \in G$. The conjugacy classes form a partition of $G$, so there is a unique conjugacy class $C_g \in \operatorname{Cl}(G)$ with $g \in C_g$. Since $g$ and the chosen representative $g_{C_g}$ belong to the same conjugacy class, there exists $h \in G$ such that
\begin{align*}
g = h g_{C_g} h^{-1}.
\end{align*}
Because $f$ is a class function, it is invariant under conjugation, and therefore
\begin{align*}
f(g) = f(h g_{C_g} h^{-1}) = f(g_{C_g}) = a_{C_g}.
\end{align*}
Next evaluate the proposed linear combination at the same element $g$. Since $g$ lies in exactly one conjugacy class, namely $C_g$, exactly one indicator function in the sum is nonzero at $g$. Hence
\begin{align*}
\sum_{C \in \operatorname{Cl}(G)} a_C \mathbb{1}_C(g) = a_{C_g}.
\end{align*}
Thus both sides have the same value at every $g \in G$, which proves
\begin{align*}
f = \sum_{C \in \operatorname{Cl}(G)} a_C \mathbb{1}_C.
\end{align*}
So the indicator functions of conjugacy classes span the [vector space](/page/Vector%20Space) $\operatorname{CF}(G)$.
[/guided]
[/step]
[step:Prove that the class indicators are linearly independent]
Suppose that scalars $b_C \in \mathbb{C}$, indexed by $C \in \operatorname{Cl}(G)$, satisfy
\begin{align*}
\sum_{C \in \operatorname{Cl}(G)} b_C \mathbb{1}_C = 0
\end{align*}
as a function $G \to \mathbb{C}$. Fix a conjugacy class $D \in \operatorname{Cl}(G)$ and choose an element $g_D \in D$. Evaluating the relation at $g_D$ gives
\begin{align*}
0 = \sum_{C \in \operatorname{Cl}(G)} b_C \mathbb{1}_C(g_D) = b_D,
\end{align*}
because $\mathbb{1}_D(g_D)=1$ and $\mathbb{1}_C(g_D)=0$ for every $C \neq D$. Since $D$ was arbitrary, $b_C = 0$ for every $C \in \operatorname{Cl}(G)$. Hence $\{\mathbb{1}_C : C \in \operatorname{Cl}(G)\}$ is linearly independent.
[/step]
[step:Count the basis elements]
The previous two steps show that
\begin{align*}
\{\mathbb{1}_C : C \in \operatorname{Cl}(G)\}
\end{align*}
is a basis of the complex vector space $\operatorname{CF}(G)$. This basis has one element for each conjugacy class $C \in \operatorname{Cl}(G)$. Therefore
\begin{align*}
\dim_{\mathbb{C}} \operatorname{CF}(G) = |\operatorname{Cl}(G)|.
\end{align*}
This is the desired equality.
[/step]