I have a problem, given $G$ is a non empty set and we know that $\star$ is associative binary operation on $G$ such that $a^2 \star b = b \star a^2$ for all $a,b \in G$. I need to proof that $G$ is abelian, I can proof $G$ is abelian but I have no idea how to proof G is a group first.
How do we proof $G$ is a group without knowing that binary operation $\star$ definition?
The assertion "G is a group" is not valid with these assumptions: take natural numbers $\mathbb{N}$ with the usual sum of integers. This operation is associative and $2a + b = b + 2a$ (addition is of course abelian, I've changed the given equation in your question to additive form) but ($\mathbb{N},+)$ is not a group.