For any subgroup $G \subset \text{GL}_n(\mathbb{R})$ the set $\mathbb{C}[x_1, \dots, x_n]^G$, of $G$-invariant polynomials, is a graded subalgebra of $\mathbb{C}[x_1, \dots, x_n]$, resp. the set $\text{Harm}(\mathbb{R}^n, G)$ of $G$-harmonic polynomials, is a graded vector subspace of $\mathbb{C}[x_1, \dots, x_n]$.

Assume that the group $G$ is compact. How do I see that $k[x_1, \dots, x_n]$, viewed as an $\mathbb{C}[x_1, \dots, x_n]^G$-module, is free if and only if $$\mathbb{C}[x_1, \dots, x_n]^G \otimes \text{Harm}(\mathbb{R}^n, G) \to k[x_1, \dots, x_n],$$induced by multiplication in $k[x_1, \dots, x_n]$, is a vector space isomorphism?

**Edit.** Here is the definition of a $G$-harmonic polynomial.