For two smooth representations $\pi_i$, $i=1,2$, of $G$, one has ${\rm Hom}_G (\pi_1 ,\pi_2 ) \simeq {\rm Hom}_G (\pi_2^\vee ,\pi_1^\vee )$$\mathrm{Hom}_G (\pi_1 ,\pi_2 ) \simeq \mathrm{Hom}_G (\pi_2^\vee ,\pi_1^\vee )$. On the other hand the contragredient of $C_c^\infty (G)$ is $C^\infty (G)$ (the space of smooth functions with arbitrary support), the pairing being given by $\langle f, g \rangle =\int_G fg\, d\mu$, $f\in C_c^\infty (G)$, $g\in C^\infty (G)$ (for some fixed Haar measure $\mu$ on $G$). Moreover the space $C^\infty (G)$ is the induced representation ${\rm Ind}_{\{ 1\}}^G {\mathbb C}$$\mathrm{Ind}_{\{ 1\}}^G {\mathbb C}$. All together, we get $$ {\rm Hom}_{G}(C_c^\infty (G), \pi )\simeq {\rm Hom}(\pi^\vee , {\rm Ind}_{\{ 1\}}^G {\mathbb C}) \simeq {\rm Hom}_{\{ 1\}} (\pi^\vee ,{\mathbb C}) $$$$ \mathrm{Hom}_{G}(C_c^\infty (G), \pi )\simeq \mathrm{Hom}_G(\pi^\vee , \mathrm{Ind}_{\{ 1\}}^G {\mathbb C}) \simeq \mathrm{Hom}_{\{ 1\}} (\pi^\vee ,{\mathbb C}), $$ where the last isomorphism follows from Frobenius reciprocity for induction.