connected sum of surfaces is well defined proof attempt Suppose $S_1$ and $S_2$ are compact surfaces (connected 2-dimensional manifolds). If we cut out of them two closed disks, and glue the surfaces along disk boundaries we get new surface, their connected sum, denoted by $S_1\#S_2$. I have precise definition in Massey's Algebraic topology, but couldn't find proof that definition is well:
Take disks $D_1 \subset S_1$ and $D_2 \subset S_2$, and define $S_i' = S_i \setminus Int(D_i)$ for $i=1,2$. Choose homeomorphism $h$ sending boundary of $D_1$ to boundary of $D_2$. Then $S_1 \# S_2$ is defined as a quotient space of $S_1' \cup S_2'$ with $x$ and $h(x)$ being identified for $x \in \partial D_1$.
My attempt (not finished):
Take now $\hat{D}_1 \subset S_1, \hat{D}_2 \subset S_2$, $\hat{S}_i' = \hat{S}_i \setminus Int(\hat{D}_i) $ for $i=1,2$ and another homeomorphism $\hat{h}$ mapping $\partial \hat{D}_1$ onto  $\partial \hat{D}_2$. 
Construct a quotient space of $\hat{S}_1' \cup \hat{S}_2'$ where $x$ and $\hat{h}(x)$ are identified for $x \in \partial D_1$.
We must be able to construct homeomorphism $g$ between those two quotient spaces. We know that there exist homeomorphism $f$ mapping boundary of $ \hat{D}_2$ onto boundary of $D_2$.
I want to define some homeomorphism on certain subsets of first space and then proceed by gluing lemma. Now I propose $g_1(x) = (h^{-1} f \hat{h})(x)$ for $x$ in the equivalence class of $ \partial D_1$ and $g_2(x) = (h^{-1} f) (x)$ for $x$ in the equivalence class of $\partial D_2$.
And now I don't have idea what to do with other points and have concern since both of those boundaries are closed as sets and what remains in complement is open... So I'm stuck here, since gluing lemma couldn't be applied, even if I  would manage to define anything on the rest of the space. 
Any idea, comment?
 A: It is highly nontrivial that the connected sum of manifolds is well-defined. First, you actually want to assume that you can thicken your embeddings of discs (the term is "locally flat"); otherwise one of your discs might be one side of the Alexander horned sphere! You want to prove that every embedding of the disc $D^n \hookrightarrow M$ is isotopic (meaning that the two embeddings are homotopic through locally flat embeddings). Two reasonable exercises are to show that if $f$ and $g$ are embeddings, then $g$ is isotopic to an embedding whose image is contained in the interior of the image of $f$; and to prove that if all (locally flat) embeddings of discs are isotopic, then the connected sum is well-defined. You'll then want the "isotopy extension theorem" for locally flat embeddings.
Now what you want to invoke is the annulus theorem to actually construct the final isotopy. This is not easy! You'll note that the Wikipedia article implies that the connected sum of manifolds was only finally proved well-defined in 1982. (It's a bit easier to prove that the connected sum of smooth manifolds is well-defined.)
If you are cynical about such theorems and demand to see proofs before you use these results, the way you should interpret theorems about $M \# N$ is "For every connected sum of $M$ and $N$, ..."
A: Mike Miller's answer brings up some really interesting points in the general topological case.  For surfaces the topological category and smooth category coincide, so let's use some differential topology to give an intuitive picture.

It's enough to be able produce a homeomorphism $p: S_1 - D_1 \to S_1 - \hat{D}_1$ that is orientation-preserving on $\partial D_1 \to \partial \hat{D}_1$.  (Note that such a map will automatically induce a homeomorphism $\partial D_1 \to \partial \hat{D}_1.$  Then we can just do the same for $S_2$, and glue the pieces together, and we'll have a homeomorphism on the whole deal.)
$S_1$ is path-connected, so take $d_1, \hat{d}_1$ the centers of $D_1, \hat{D}_1$ and $\gamma: [0,1] \to S_1$ a path with $\gamma(0) = d_1$ and $\gamma_1 = \hat{d}_1$.  Now we'll apply the tubular neighborhood theorem to the image of $\gamma$, which must be compact.  So we get some open set $U \subset S_1$ that's an open neighborhood of $\gamma([0,1])$, and hence contains small disks $U_1$ and $\hat{U}_1$ around $d_1$ and $\hat{d}_1$.
Then we simply construct our desired homeomorphism in three stages:


*

*Construct a homeomorphism $S_1 - D_1 \to S_1 - U_1$.  (Just shrink!)

*Transport $U_1$ inside $U$ to $\hat{U}_1 \ni \hat{d}_1$, also contained in $U$, so that we have a homeomorphism $S_1 - U_1 \to S_1 - \hat{U}_1$.  An explicit construction would be unilluminating: let's have a picture instead.  Think of $U$ as soap stretched across a long, skinny, ellipsoidal ring, and $\overline{U_1}$ as a small ring inside $U$ that doesnt' contain any soap.  Drag $\overline{U_1}$ to $\overline{\hat{U}_1}$; let the homeomorphism be the identity outside $U$, and let it describe how the soap particles move when we move the ring.

*Construct a homeomorphism $S_1 - \hat{U}_1 \to S_1 - \hat{D}_1$.  (Just expand!)
The composition of these three maps gives you the desired homeomorphism $S_1 - D_1 \to S_1 - \hat{D}_1.$
