I preferred writing another answer instead of editing my previous one, because this one addresses some new issues and provides a different solution.
Note: This is a very long answer which contains gory details about inner workings of matrix of nodes, pic, etc.. If you are only interested in the final solution, jump to section "Final solution".
The ideal (but almost impossible) way:
I like the pic approach. However, as stated in my other answer, once you put a \draw command in a cell of a matrix of nodes, you break the automatic naming system.
To understand why (and a possible solution) we have to understand first what tikz does in a matrix of nodes. Basically, if you put inside a cell the text:
\matrix (m) [matrix of nodes, ... other options... ] {
|whatever| foo \& ... \\
...
};
Tikz generates for that cell the command:
\node (m-1-1) whatever {foo};
I.e. it automatically puts a \node commando, assigns an automatic name to the node, pass whatever options you wrote inside the vertical bars, and finally the contents of the cell are passed to the argument (content) of the node.
However, if the content of the cell is \path, \draw, \fill, or \node, none of the above is done, but instead the content of that cell is whatever drawing command you specified. So, if you have:
\matrix (m) [matrix of nodes, ... other options... ] {
\draw pic {bSum}; \& ... \\
...
};
Then that cell contains only \draw pic {bSum}; and thus no automatic node name is assigned.
This explains why it does not work. But it also cast some light about how to make it work.
pic elements can be part of a \draw or \path command, as we know, but I discovered that they can be also part of a \node command if they are used after the node content. I.e: the following does not work (in general, for any pic shape):
\node pic {bSum} {node contents};
But the following does work:
\node {node contents} pic {bSum};
and places at the same coordinates the node contents and the pic.
So this should work, even if it is a horrible hack:
\matrix (m) [matrix of nodes, ... other options... ] {
|{} pic{bSum};| IGNORED TEXT \& ... \\
...
};
Because that cell will be expanded as:
\node {} pic{bSum}; {IGNORED TEXT};
Note that the IGNORED TEXT is not part of any tikz command, so it will be ignored by tikz (in fact, it will be typeset with the null font).
The following code is a proof of concept (note that I've simplified the pic code compared with my other answer, but this is unrelated to the characteristic that we are studying here):
\documentclass{article}
\usepackage{tikz}
\begin{document}
\usetikzlibrary{calc,shadows,matrix}
\usepgflibrary{shapes.misc}
\tikzset{
myShape/.style = {
circle, minimum size=1.5em, fill, drop shadow={opacity=1},
draw, thick
},
myCross/.style = {
draw, cross out, minimum size=1.0em, thin, draw=gray!50,
},
bSum/.pic = {
\node [myShape] at (0,0) {};
\node [myCross] at (0,0) {};
\foreach \t [count=\i] in {#1}{
\pgfmathsetmacro{\angle}{\i*90}
\node[anchor=center] at (\angle:0.45em) {\tiny$\t$};
}
},
}
\begin{tikzpicture}
\matrix (m) [matrix of nodes, ampersand replacement=\&,
column sep = 1.5cm, row sep = 1.2cm]{
|{} pic[fill=yellow!20] {bSum={+,+, ,-}};| IGNORED TEXT \\
A \\
};
\draw (m-1-1) -- (m-2-1); % <-- IT WORKS!! :D
\end{tikzpicture}
\end{document}
So the syntax works, but it is a horrible hack, and besides, the result is:

You can see that the line does not end at the edge of the circle, nor at its center, but a bit "inside". This is because (m-1-1) is the name of the empty node what we put in that position of the matrix, which has a default minimum size.
A possible solution is to specify additional options for this empty node, so that it has circular shape of the same radius than the pic:
\begin{tikzpicture}
\matrix (m) [matrix of nodes, ampersand replacement=\&,
column sep = 1.5cm, row sep = 1.2cm]{
|[circle, minimum size=1.5em] {} pic[fill=yellow!20] {bSum={+,+, ,-}};| IGNORED TEXT \\
A \\
};
\draw (m-1-1) -- (m-2-1);
\end{tikzpicture}
And it would work, but the syntax is uglier and uglier...
A different approach
A different approach is to use a name for the pic, and then use that name to refer to that node, instead of the standard (m-1-1). This is the idea:
\matrix (m) [matrix of nodes, ... other options... ] {
\draw pic[options] (myName) {bSum} \& ... \\
...
};
If you give a name to a pic in this way, this name does not refer to any particular node, but it is instead a name prefix for any node name defined inside the pic. So we can give a name to the circular node which makes the shape, for example -edge, and thus, we can refer to (myName-edge) from any other part of this tikzpicture.
This looks like a good idea. However, in this particular case more problems appear due to the use of drop shadow. Apparently, this option uses the node named (current bounding box) for its computations. But since it appears inside a pic whose namespace is myName, tikz gets confused and tries to use instead the node named (myNamecurrent bounding box) which does not exist.
To avoid this problem we have to "reset" the namespace when drawing the shadow, via name prefix .. option. So we have to draw the shape of the bSum in two phases: one without namespace prefixes for drawing the shadow, other with namespace prefixes for drawing the circular contour and give it a name available from outside. So...
The final solution
\documentclass{article}
\usepackage{tikz}
\begin{document}
\usetikzlibrary{calc,shadows,matrix}
\usepgflibrary{shapes.misc}
\tikzset{
myShape background/.style = { % For the first phase
circle, minimum size=1.5em, fill, drop shadow={opacity=1},
name prefix ..
},
myShape edge/.style = { % For the second phase
draw, circle, minimum size=1.5em, thick,
},
myCross/.style = {
draw, cross out, minimum size=1.0em, thin, draw=gray!50,
},
bSum/.pic = {
\node [myShape background] at (0,0) {}; % First phase
\node [myCross] at (0,0) {};
\foreach \t [count=\i] in {#1}{
\pgfmathsetmacro{\angle}{\i*90}
\node[anchor=center] at (\angle:0.45em) {\tiny$\t$};
}
\node [myShape edge] (-edge) at (0,0) {}; % Second phase, give it a name
},
}
\begin{tikzpicture}
\matrix (m) [matrix of nodes, ampersand replacement=\&,
column sep = 1.5cm, row sep = 1.2cm]{
\draw pic[fill=white] (S) {bSum={+,+, ,-}}; \\
A \\
};
\draw[latex-] (S-edge) -- (m-2-1);
\end{tikzpicture}
\end{document}
Note the (S) option we passed to pic. This causes S to be the namespace prefix, so the (-edge) named node inside the pic is available from outside under the name (S-edge). This code produces the desired result:

Of course, nothing stops you to give (m-1-1) as namespace prefix instead of (S). However, remember that this does not define a node named (m-1-1), but a namespace prefix. You still have to use (m-1-1-edge) to refer to the actual pic shape.
Update: the final hack
I realized that if you give the namespace (m) to the pic element, and inside it you give the name (-1-1) to the last circular node, then you can access to (m-1-1) from anywhere in your tikzpicture to refer to the circular node in that cell. Indeed, you can use the counters \pgfmatrixcurrentrow and \pgfmatrixcurrentcolumn as part of the node name in the pic, and thus finally achieve the desired goal.
The following code shows a complete example:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\thispagestyle{empty}
\usetikzlibrary{calc,shadows,matrix}
\usepgflibrary{shapes.misc}
\tikzset{
myShape background/.style = { % For the first phase
circle, minimum size=1.5em, fill, drop shadow={opacity=1},
name prefix ..
},
myShape edge/.style = { % For the second phase
draw, circle, minimum size=1.5em, thick,
},
myCross/.style = {
draw, cross out, minimum size=1.0em, thin, draw=gray!50,
},
bSum/.pic = {
\node [myShape background] at (0,0) {}; % First phase
\node [myCross] at (0,0) {};
\foreach \t [count=\i] in {#1}{
\pgfmathsetmacro{\angle}{\i*90}
\node[anchor=center] at (\angle:0.45em) {\tiny$\t$};
}
\node [myShape edge] % Second phase, give it a name
(-\the\pgfmatrixcurrentrow-\the\pgfmatrixcurrentcolumn)
at (0,0) {};
},
}
\begin{tikzpicture}
\matrix (m) [matrix of nodes, ampersand replacement=\&,
column sep = 1.5cm, row sep = 1.2cm, nodes={anchor=center}]{
\draw pic[fill=white] (m) {bSum={+,+,-,}}; \& B \\
A \& \draw pic[fill=green!10] (m) {bSum={,\odot,\smile,\prec}}; \\
};
\draw[-latex] (m-2-1) -- (m-2-2); % <-- It works!
\draw[-latex] (m-1-1) -- (m-2-2); % <-- It works!
\end{tikzpicture}
\end{document}
Result:

name prefix ..(which seems to be usable only one), use\tikzmatrixnameso that you could define more shapes... – s__C Jun 10 '14 at 19:54pic, or to define otherpics to be used in other places of the matrix? Could be more specific about the problems when using "more shapes"? Perhaps it may worth posting another question? – JLDiaz Jun 11 '14 at 07:13(\tikzmatrixname-\the\pgfmatrixcurrentrow-\the\pgfmatrixcurrentcolumn)instead of just the suffix and by deletingname prefix ..in the style – s__C Jun 11 '14 at 08:05