Is the median a type of mean, for some generalization of "mean"? The concept of "mean" roams far wider than the traditional arithmetic mean; does it stretch so far as to include the median? By analogy,
$$
\text{raw data} \overset{\text{id}}{\longrightarrow} \text{raw data} \overset{\text{mean}}{\longrightarrow} \text{raw mean} \overset{\text{id}^{-1}}{\longrightarrow}  \text{arithmetic mean} \\
\text{raw data} \overset{\text{recip}}{\longrightarrow} \text{reciprocals} \overset{\text{mean}}{\longrightarrow} \text{mean reciprocal} \overset{\text{recip}^{-1}}{\longrightarrow}  \text{harmonic mean} \\
\text{raw data} \overset{\text{log}}{\longrightarrow} \text{logs} \overset{\text{mean}}{\longrightarrow} \text{mean log} \overset{\text{log}^{-1}}{\longrightarrow}  \text{geometric mean} \\
\text{raw data} \overset{\text{square}}{\longrightarrow} \text{squares} \overset{\text{mean}}{\longrightarrow} \text{mean square} \overset{\text{square}^{-1}}{\longrightarrow}  \text{root mean square} \\
\text{raw data} \overset{\text{rank}}{\longrightarrow} \text{ranks} \overset{\text{mean}}{\longrightarrow} \text{mean rank} \overset{\text{rank}^{-1}}{\longrightarrow}  \text{median} 
$$
The analogy I am drawing is to the quasi-arithmetic mean, given by:
$$M_f(x_1,\dots,x_n)=f^{-1}\left(\frac{1}{n}\sum_{i=1}^{n}f(x_i) \right)$$
For comparison, when we say that the median of a five-item dataset is equal to the third item, we can see that as equivalent to ranking the data from one to five (which we might denote by a function $f$); taking the mean of the transformed data (which is three); and reading back off the value of the item of data that had rank three (a sort of $f^{-1}$). 
In the examples of geometric mean, harmonic mean and RMS, $f$ was a fixed function that can be applied to any number in isolation. In contrast, either to assign a rank, or to work back from ranks to the original data (interpolating where necessary) requires knowledge of the entire data set. Moreover in definitions I have read of the quasi-arithmetic mean, $f$ is required to be continuous. Is the median ever considered as a special case of quasi-arithmetic mean, and if so how is the $f$ defined? Or is the median ever described as an instance of some other wider notion of "mean"? The quasi-arithmetic mean is certainly not the only generalization available.
Part of the issue is terminological (what does "mean" mean anyway, especially in contrast to "central tendency" or "average"?). For instance, in the literature for fuzzy control systems, an aggregation function $F:[a,b] \times [a,b] \to [a,b]$ is an increasing function with $F(a,a)=a$ and $F(b,b)=b$; an aggregation function for which $\min(x,y) \leq F(x,y) \leq \max(x,y)$ for all $x,y \in [a,b]$ is called a "mean" (in a general sense). Such a definition is, needless to say, incredibly broad! And in this context the median is indeed referred to as a type of mean.$^{[1]}$ But I am curious whether less broad characterisations of the mean can still extend far enough to encompass the median – the so-called generalized mean (which might better be described as the "power mean") and the Lehmer mean do not, but others may. For what it's worth, Wikipedia includes "median" in its list of "other means", but without further comment or citation.
$[1]$: Such a broad definition of mean, suitably extended for more than two inputs, seems standard in the field of fuzzy control and cropped up many times during internet searches for instances of the median being described as a median; I will cite e.g. Fodor, J. C., & Rudas, I. J. (2009), "On Some Classes of Aggregation Functions that are Migrative", IFSA/EUSFLAT Conf. (pp. 653-656). Incidentally, this paper notes that one of the earliest users of the term "mean" (moyenne) was Cauchy, in the Cours d'analyse de l'École royale polytechnique, 1ère partie; Analyse algébrique (1821). Later contributions of Aczél, Chisini, Kolmogorov and de Finetti in developing more general concepts of "mean" than Cauchy are acknowledged in Fodor, J., and Roubens, M. (1995), "On meaningfulness of means", Journal of Computational and Applied Mathematics, 64(1), 103-115.
 A: Here's one way that you might regard a median as a "general sort of mean" -- first, carefully define your ordinary arithmetic mean in terms of order statistics:
$$\bar{x} = \sum_i w_i x_{(i)},\qquad w_i=\frac{_1}{^n}\,.$$
Then by replacing that ordinary average of order statistics with some other weight function, we get a  notion of "generalized mean" that accounts for order.
In that case, a host of potential measures of center become "generalized sorts of means". In the case of the median, for odd $n$, $w_{(n+1)/2}=1$ and all others are 0, and for even $n$, $w_{\frac{n}{2}}=w_{\frac{n}{2}+1}=\frac{1}{2}$.
Similarly, if we look at M-estimation, location estimates might also be thought of as a generalization of the arithmetic mean (where for the mean, $\rho$ is quadratic, $\psi$ is linear, or the weight-function is flat), and the median falls also into this class of generalizations. This is a somewhat different generalization than the previous one.
There are a variety of other ways we might extend the notion of 'mean' that could include median. 
A: The question invites us to characterize the concept of "mean" in a sufficiently broad sense to encompass all the usual means--power means, $L^p$ means, medians, trimmed means--but not so broadly that it becomes almost useless for data analysis.  This reply discusses some of the axiomatic properties that any reasonably useful definition of "mean" should have.

Basic Axioms
A usefully broad definition of "mean" for the purpose of data analysis would be any sequence of well-defined, deterministic functions $f_n:A^n\to A$ for $A\subset\mathbb{R}$ and $n=1, 2, \ldots$ such that
(1) $\newcommand{\x}{\mathrm{x}} \newcommand{\min}{\text{min}}\min (\x)\le f_n(\x)\le \max(\x)$ for all $\x = (x_1, x_2, \ldots, x_n)\in A^n$ (a mean lies between the extremes),
(2) $f_n$ is invariant under permutations of its arguments (means do not care about the order of the data), and
(3) each $f_n$ is nondecreasing in each of its arguments (as the numbers increase, their mean cannot decrease).
We must allow for $A$ to be a proper subset of real numbers (such as all positive numbers) because plenty of means, such as geometric means, are defined only on such subsets.
We might also want to add that
(1') there exists at least some $\x\in A$ for which $\min(\x)\ne f_n(\x)\ne \max(\x)$ (means are not extremes).  (We cannot require that this always hold.  For instance, the median of $(0,0,\ldots,0,1)$ equals $0$, which is the minimum.)
These properties seem to capture the idea behind a "mean" being some kind of "middle value" of a set of (unordered) data.
Consistency axioms
I am further tempted to stipulate the rather less obvious consistency criterion
(4.a) The range of $f_{n+1}(t, x_1, x_2, \ldots, x_n)$ as $t$ varies throughout the interval $[\min(\x), \max(\x)]$ includes $f_n(\x)$.  In other words, it is always possible to leave the mean unchanged by adjoining an appropriate value $t$ to a dataset.  In conjunction with (3), it implies that adjoining extreme values to a dataset will pull the mean towards those extremes.
If we wish to apply the concept of mean to a distribution or "infinite population", then one way would be to obtain it in the limit of arbitrarily large random samples.  Of course the limit might not always exist (it does not exist for the arithmetic mean when the distribution has no expectation, for instance).  Therefore I do not want to impose any additional axioms to guarantee the existence of such limits, but the following seems natural and useful:
(4.b) Whenever $A$ is bounded and $\x_n$ is a sequence of samples from a distribution $F$ supported on $A$, then the limit of $f_n(\x_n)$ almost surely exists.  This prevents the mean from forever "bouncing around" within $A$ even as sample sizes get larger and larger.
Along the same lines, we could further narrow the idea of a mean to insist that it become a better estimator of "location" as sample sizes increase:
(4.c) Whenever $A$ is bounded, then the variance of the sampling distribution of $f_n(X^{(n)})$ for a random sample $X^{(n)} = (X_1, X_2, \ldots, X_n)$ of $F$ is nondecreasing in $n$.
Continuity axiom
We might consider asking means to vary "nicely" with the data:
(5) $f_n$ is separately continuous in each argument (a small change in the data values should not induce a sudden jump in their mean).
This requirement might eliminate some strange generalizations, but it does not rule out any well-known mean.  It will rule out some aggregation functions.
An invariance axiom
We can conceive of means as applying to either interval or ratio data (in Stevens' well-known sense).  We cannot demand they be invariant under shifts of location (the geometric mean is not), but we can require
(6) $f_n(\lambda \x) = \lambda f_n(\x)$ for all $\x \in A^n$ and all $\lambda \gt 0$ for which $\lambda \x \in A^n$.  This says only that we are free to compute $f_n$ using any units of measurement we like.
All the means mentioned in the question satisfy this axiom except for some aggregation functions.

Discussion
General aggregation functions $f_2$, as described in the question, do not necessarily satisfy axioms (1'), (2), (3), (5), or (6).  Whether they satisfy any consistency axioms may depend on how they are extended to $n\gt 2$.
The usual sample median enjoys all these axiomatic properties.
We could augment the consistency axioms to include
(4.d)     $f_{2n}(\x;\x) = f_n(\x)$ for all $\x \in A^n.$
This implies that when all elements of a dataset are repeated equally often, the mean does not change.  This may be too strong, though: the Winsorized mean does not have this property (except asymptotically). The purpose of Winsorizing at the $100\alpha\%$ level is to provide resistance against changes in at least $100\alpha\%$ of the data at either extreme. For instance, the 10% Winsorized mean of $(1,2,3,6)$ is the arithmetic mean of $(2,2,3,3)$, equal to $2.5$, but the 10% Winsorized mean of $(1,1,2,2,3,3,6,6)$ is $3.5$.
I do not know which of the consistency axioms (4.a), (4.b), or (4.c) would be most desirable or useful.  They appear to be independent: I don't think any two of them imply the third.
A: One easy but fruitful generalization is to weighted means, $\sum_{i=1}^n w_i x_i / \sum_{i=1}^n w_i,$ where $\sum_{i=1}^n w_i = 1$. Clearly the common or garden mean is the simplest special case with equal weights $w_i = 1/n$. 
Letting the weights depend on the order of values in magnitude, from smallest to largest, points to various other special cases, notably the idea of a trimmed mean, which is known by other names too. 
To avoid excessive use of notation where it is not needed or especially helpful, imagine for example ignoring the smallest and largest values and taking the (equally weighted) mean of the others. Or imagine ignoring the two smallest and two largest and taking the mean of the others; and so forth. The most vigorous trimming would ignore all but the one or two middle values in order, depending on whether the number of values was odd or even, which is naturally just the familiar median. Nothing in the idea of trimming commits you to ignoring equal numbers in each tail of a sample, but saying more about asymmetric trimming would take us further away from the main idea in this thread. 
In short, means (unqualified) and medians are extreme limiting cases of the family of (symmetric) trimmed means. The overall idea is to allow compromises between one ideal of using all the information in the data and another ideal of protecting oneself from extreme data points, which may be unreliable outliers. 
See the reference here for one fairly recent review.
A: I think the median can be considered a type of a generalization of the arithmetic mean.  Specifically, the arithmetic mean and the median (among others) can be unified as special cases of the Chisini mean.  If you are going to perform some operation over a set of values, the Chisini mean is a number that you can substitute for all of the original values in the set and still get the same result.  For example, if you want to sum your values, replacing all the values with the arithmetic mean will yield the same sum.  The idea is that a certain value is representative of the numbers in the set in the context of a certain operation over those numbers.  (An interesting implication of this way of thinking is that a given value—the arithmetic mean—can only be considered representative under the assumption that you are doing certain things with those numbers.)  
This is less obvious for the median (and I note that the median is not listed as one of the Chisini means on Wolfram or Wikipedia), but if you were to allow operations over ranks, the median could fit within the same idea.  
A: If you think of the mean as the point minimizing the quadratic loss function SSE, then the median is the point minimizing the linear loss function MAD, and the mode is the point minimizing some 0-1 loss function.  No transformations required.
So the median is an example of a Fréchet mean.
A: The question is not well defined. If we agree on the common "street" definition of mean as the sum of n numbers divided by n then we have a stake in the ground. Further If we would look at measures of central tendency we could say both Mean and Median are generealization but not of each other. Part of my background is in non parametrics so I like the median and the robustness it provides, invariance to monotonic transformation and more. but each measure has it's place depending on objective.
