Let us denote $<(X,x_0), (Y,y_0)>$ the set of basepoint-preserving-homotopy classes of basepoint-preserving maps $X \to Y$; and $[X,Y]$ the set of homotopy classes of maps $X \to Y$.
There is a natural map $$<(X,x_0), (Y,y_0)> \to [X,Y]$$ sending $[f]_*$ (equivalence class of $f: X \to Y$ in the first space) to $[f]$ (equivalence class of $f$ in the second one).
I am trying to prove that if $X$ is an absolute CW-complex with $x_0$ a 0-cell, and $Y$ is path-connected and simply connected, the previous map is a bijection.
I have been suggested to use that the pairs $(X,\{ x_0 \})$ and $(X \times [0,1], X \times \{ 0,1 \} \cup \{x_0 \} \times [0,1])$ have the homotopy extension property.
Let $X$ be a space with basepoint $\ast$. We'll assume that $X$ is well-pointed, which here means that the inclusion $\ast\hookrightarrow X$ is a cofibration. This assumption will be met when $X$ is a CW complex and $\ast$ is any point. Let $X_+$ denote the disjoint union of $X$ with an extra point $+$. The basepoint of $X_+$ will be the point $+$.
Letting $S^0=\partial I=\{0,1\}$ we have a canonical inclusion $j:S^0\rightarrow X_+$ which sends $0$ to $\ast\in X$ and the basepoint $1$ to $+$ (this is just $\ast_+\hookrightarrow X_+$). Because of the non-degenerated basepoint of $X$ this map is a cofibration. Thus we have a cofiber sequence of based spaces $$S^0\xrightarrow{j} X_+\rightarrow X.$$ Now let $Y$ be a based space and let $\langle X,Y\rangle$ be the set of pointed homotopy classes of maps $X\rightarrow Y$. Let also $[X,Y]$ denote the set of unpointed homotopy classes $X\rightarrow Y$. Observe that $\langle X_+,Y\rangle=[X,Y]$. From the cofiber sequence we get an exact sequence of pointed sets $$\dots\rightarrow\langle\Sigma(X_+),Y\rangle\xrightarrow{\Sigma j^*}\pi_1Y\rightarrow \langle X,Y\rangle\xrightarrow{U} [X,Y]\xrightarrow{j^*} \pi_0Y.$$ It's easy to see that $U$ is nothing but the forgetful map which sends pointed homotopy classes to unpointed. On the right the map $j^*$ is onto. This is because $j$ has a retraction $r:X_+\rightarrow S^0$ which sends $+$ to $1$ and collapses $X$ to $0$. This also means that $\Sigma j$ has a retraction (namely $\Sigma r$), so $\Sigma j^*$ is onto.
Thus from the sequence above we extract a short exact sequence of pointed sets $$0\rightarrow \langle X,Y\rangle\xrightarrow{U}[X,Y]\rightarrow \pi_0Y\rightarrow 0.$$ As just mentioned, the right-hand map is sujective. If $Y$ is path-connected, then $\pi_0Y=0$ and $U$ is surjective. In this case each unpointed homotopy class has a pointed representative.
On the other side, $U$ is not injective in general. Note how weak the exactness property is for pointed sets. What exactness means here is that if $f\in\langle X,Y\rangle$ becomes trivial in $[X,Y]$, then $f$ is already trivial. i.e. a based map $f:X\rightarrow Y$ is pointed null-homotopic if and only if it is freely null-homotopic.
Away from the trivial class the exactness gives us nothing. The cofibration sequence, however, does give us something. Namely it provides an action of $\langle S^1,Y\rangle=\pi_1Y$ on $\langle X,Y\rangle$, which I will write with a $\dot+$. The general theory says that if $U(f)=U(g)$, then there is $\alpha\in\pi_1Y$ such that $g\simeq f\dot+\alpha$ (pointed homotopy).
In particular, if $Y$ is simply connected, then $\pi_1Y=0$ and the action is trivial. In this case $U$ is injective. If furthermore $\pi_0Y=0$, then $U$ is bijective.
On the other hand, if $\pi_0Y=0$, then we can always identify $[X,Y]$ as the quotient of $\langle X,Y\rangle$ by this $\pi_1Y$-action.
Topologically the action is realised by means of a map $\nu:X\rightarrow X\vee S^1$, and all the properties of the action follow from properties of this map. The class $f\dot+\alpha$ is represented by the composition $$f\dot+\alpha:X\xrightarrow\nu X\vee S^1\xrightarrow{f\vee\alpha}Y\vee Y\xrightarrow\nabla Y$$ where $\nabla$ is the folding map.
A representative for $\nu$ can be found explicitly as following. Let $X\cup I$ be the (reduced) mapping cone of $j:S^0\hookrightarrow X$. Thus $X\cup I$ is $X$ with a 'whisker' grown over the basepoint. The basepoint in $X\cup I$ is $1\in I$. However, because $X$ is well-pointed, the collapse map $X\cup I\rightarrow X$ is a pointed homotopy equivalence. The fact that it is a homotopy equivalence is easy to see (collapse the whisker). The nontrivial point is to realise the inverse as a pointed map. For this you need to use the homotopy extension property of $\ast\hookrightarrow X$ to extend the homotopy $(\ast,t)\mapsto t\in I$. Then $\nu$ may be given as the composite $$\nu:X\simeq X\cup I\rightarrow X\vee S^1$$ where the first map is a point homotopy equivalence and the second identifies the two ends of the interval to $\ast\in X$.