Let $A$, $B$ $\subseteq \mathbb{R^n}$ be connected sets and suppose that $\overline{A} \cap B \ne \emptyset$. Prove that $A\cup B$ is connected.
My attempt: I've tried a proof by contradiction.
Suppose that $A\cup B$ is disconnected, e.g. $A\cup B = X\cup Y$, where $X, Y$ are disjoint, nonempty, and open in $A\cup B$.
Besides that, we have $A\cap X$ and $Y\cap A$ open in $A$, and that they cover A. But since A is connected by hypotesis, then we can suppose that $A\cap X= \emptyset$. And that implies that $A \subseteq Y$.
So far, so good... but where do I get the contradiction? Where do I use that $\overline{A} \cap B \ne \emptyset$? Any help to finish this proof would be appreciated!