We report on the optical identification of the companion to the eclipsing millisecond pulsar PSR J1701$-$3006B in the globular cluster NGC 6266. A relatively bright star with an anomalous red colour and an optical variability ($sim$ 0.2 mag) that nicely correlates with the orbital period of the pulsar ($sim$ 0.144 days) has been found nearly coincident with the pulsar nominal position. This star is also found to lie within the error box position of an X-ray source detected by Chandra observations, thus supporting the hypothesis that some interaction is occurring between the pulsar wind and the gas streaming off the companion. Although the shape of the optical light curve is suggestive of a tidally deformed star which has nearly completely filled its Roche lobe, the luminosity ($sim 1.9 L_odot$) and the surface temperature ($sim 6000$ K) of the star, deduced from the observed magnitude and colours, would imply a stellar radius significantly larger than the Roche lobe radius. Possible explanations for this apparent inconsistency are discussed.